package org.dromara.demo.domain;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.tenant.core.TenantEntity;

import java.io.Serial;
import java.util.List;

/**
 * 测试主从对象 test_demo2
 *
 * @author wenrui Su
 * @date 2024-03-24
 */
@Data
@ExcelIgnoreUnannotated
@EqualsAndHashCode(callSuper = true)
@TableName("demo_example2")
public class DemoExample2 extends TenantEntity {

  @Serial
  private static final long serialVersionUID = 1L;

  @NotNull(message = "主键不能为空", groups = { EditGroup.class })
  @TableId(value = "id")
  @ExcelProperty(value = "主键")
  private Long id;

  @ExcelProperty(value = "名称")
  private String name;

  @ExcelProperty(value = "部门id")
  private Long deptId;

  private Long userId;

  @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
  @ExcelDictFormat(dictType = "sys_status")
  private String status;

  /**
   * 值
   */
  private String remark;

//  ========================新增非数据库的
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private List<DemoExample2Line> line;
}
